#include <algorithm>
#include <string>

using namespace std;

class Solution {
public:
    bool checkIfCanBreak(string s1, string s2) {
        sort(s1.begin(), s1.end());
        sort(s2.begin(), s2.end());
        bool success = true;
        for (int i = 0; i < s1.size(); i++) {
            if (s1[i] < s2[i]) {
                success = false;
                break;
            }
        }
        if (success) {
            return true;
        }
        success = true;
        for (int i = 0; i < s1.size(); i++) {
            if (s2[i] < s1[i]) {
                success = false;
                break;
            }
        }
        return success;
    }
};